package com.example.springboottest.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

/**
 * HelloController控制器类——返回一个String字符串
 * @author CZX
 */
@Controller
@RequestMapping("/")
public class HelloController {

    @RequestMapping(value = {"/login","/","/login.html"})
    public String hello(){
        //调用业务，接受前端参数
        return "login";
    }

    @RequestMapping(value = "/index")
    public String toIndex(){
        return "index";
    }
    @RequestMapping("/id")
    @ResponseBody
    public HashMap<String,String> toList(){
        HashMap<String,String> lists;
        lists = new HashMap<>();
        lists.put("code","1232");
        lists.put("status","1");
        return lists;
    }
    @RequestMapping(value = "/register")
    public String toRegister(){
        return "register";
    }
    @RequestMapping(value = "/register1")
    public String toRegister1(){
        return "register1";
    }
    @GetMapping("toRegister1")
    public String Register1( String username,
                        String password){

        return "index";
    }

    @PostMapping("toRegister")
    public String register(@RequestParam String username,
                           @RequestParam String password){

        return "index";
    }

}

